@tailwind base;
@tailwind components;
@tailwind utilities;

@layer base {
  :root {
    --accent-color: 157, 87%, 41%;
    --base-background: 0, 0%, 100%;
    
    /* 新粗野主义色彩系统 */
    --tech-blue: #0057FF;
    --neon-green: #00FF85;
    --pure-black: #000000;
    --pure-white: #ffffff;
    --neutral-gray: #888888;

    /* Navbar */
    --navbar-text-color: #000000;
    --navbar-text-size: 0.9rem;
    --navbar-text-letter-spacing: -0.14px;
    --navbar-text-line-height: 1.4;
    /* Navbar */

    --background: 0 0% 100%;
    --foreground: 240 10% 3.9%;

    --card: 0 0% 100%;
    --card-foreground: 240 10% 3.9%;

    --popover: 0 0% 100%;
    --popover-foreground: 240 10% 3.9%;

    --primary: 240 5.9% 10%;
    --primary-foreground: 0 0% 98%;

    --secondary: 240 4.8% 95.9%;
    --secondary-foreground: 240 5.9% 10%;

    --muted: 240 4.8% 95.9%;
    --muted-foreground: 240 3.8% 46.1%;

    --accent: 240 4.8% 95.9%;
    --accent-foreground: 240 5.9% 10%;

    --destructive: 0 84.2% 60.2%;
    --destructive-foreground: 0 0% 98%;

    --border: 240 5.9% 90%;
    --input: 240 5.9% 90%;
    --ring: 240 10% 3.9%;

    --radius: 0rem; /* 新粗野主义：无圆角 */
  }

  .dark {
    --accent-color: 157, 87%, 41%;
    --base-background: 193, 20%, 9%;
    
    /* 新粗野主义色彩系统 */
    --tech-blue: #0057FF;
    --neon-green: #00FF85;
    --pure-black: #000000;
    --pure-white: #ffffff;
    --neutral-gray: #888888;

    /* Navbar */
    --navbar-text-color: #cecece;
    --navbar-text-size: 0.9rem;
    --navbar-text-letter-spacing: -0.14px;
    --navbar-text-line-height: 1.4;
    /* Navbar */

    --background: 0 0% 5%;
    --foreground: 0 0% 95%;

    --card: 0 0% 5%;
    --card-foreground: 0 0% 95%;

    --popover: 0 0% 5%;
    --popover-foreground: 0 0% 95%;

    --primary: 0 0% 95%;
    --primary-foreground: 0 0% 5%;

    --secondary: 0 0% 10%;
    --secondary-foreground: 0 0% 95%;

    --muted: 0 0% 10%;
    --muted-foreground: 0 0% 60%;

    --accent: 0 0% 10%;
    --accent-foreground: 0 0% 95%;

    --destructive: 0 84.2% 60.2%;
    --destructive-foreground: 0 0% 98%;

    --border: 0 0% 20%;
    --input: 0 0% 20%;
    --ring: 0 0% 95%;

    --radius: 0rem; /* 新粗野主义：无圆角 */
  }
}

@layer base {
  html {
    @apply scroll-smooth;
  }
  * {
    @apply border-border;
  }
  body {
    @apply bg-background text-foreground;
    font-family: 'Inter', sans-serif;
  }
  
  /* 只在客户端隐藏光标 */
  .cursor-hidden {
    cursor: none;
  }
  
  /* 自定义光标 */
  .custom-cursor {
    position: fixed;
    left: 0;
    top: 0;
    background: var(--tech-blue);
    border-radius: 50%;
    pointer-events: none;
    z-index: 9999;
    mix-blend-mode: difference;
    box-shadow: 
      0 0 10px rgba(59, 130, 246, 0.3),
      0 0 20px rgba(59, 130, 246, 0.1);
    transform: translate(-50%, -50%);
    will-change: transform, width, height, background, box-shadow;
    transition: width 0.2s ease, height 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
  }
  
  .custom-cursor.hovering {
    background: var(--neon-green);
    box-shadow: 
      0 0 15px rgba(34, 197, 94, 0.5),
      0 0 30px rgba(34, 197, 94, 0.2),
      0 0 40px rgba(34, 197, 94, 0.1);
    animation: pulse-glow 2s ease-in-out infinite;
  }
  
  .custom-cursor.active {
    background: var(--tech-blue);
    box-shadow: 
      0 0 20px rgba(59, 130, 246, 0.8),
      0 0 40px rgba(59, 130, 246, 0.4);
  }
  
  @keyframes pulse-glow {
    0%, 100% {
      box-shadow: 
        0 0 15px rgba(34, 197, 94, 0.5),
        0 0 30px rgba(34, 197, 94, 0.2),
        0 0 40px rgba(34, 197, 94, 0.1);
    }
    50% {
      box-shadow: 
        0 0 20px rgba(34, 197, 94, 0.8),
        0 0 40px rgba(34, 197, 94, 0.4),
        0 0 60px rgba(34, 197, 94, 0.2);
    }
  }
  

  
  .cursor-tooltip {
    position: fixed;
    left: 0;
    top: 0;
    background: linear-gradient(135deg, var(--pure-black) 0%, #1a1a1a 100%);
    color: var(--tech-blue);
    padding: 6px 12px;
    border-radius: 6px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    font-weight: 500;
    pointer-events: none;
    z-index: 10000;
    opacity: 0;
    border: 1px solid rgba(59, 130, 246, 0.2);
    box-shadow: 
      0 4px 20px rgba(0, 0, 0, 0.3),
      0 0 0 1px rgba(59, 130, 246, 0.1);
    backdrop-filter: blur(10px);
    will-change: transform, opacity;
    transition: opacity 0.3s ease;
    transform: translate(-50%, -100%) translateY(-8px);
  }
  
  .cursor-tooltip.visible {
    opacity: 1;
  }
  


  ::selection {
    background-color: var(--tech-blue);
    color: var(--pure-white);
  }
  ::-webkit-selection {
    background-color: var(--tech-blue);
    color: var(--pure-white);
  }

  ::-moz-selection {
    background-color: var(--tech-blue);
    color: var(--pure-white);
  }
}

@layer components {
  /* 新粗野主义按钮样式 */
  .neo-brutal-btn {
    @apply px-4 py-3 sm:px-6 sm:py-4 font-bold text-base sm:text-lg tracking-tight;
    background: var(--tech-blue);
    color: var(--pure-white);
    border: 2px solid var(--pure-black);
    box-shadow: 3px 3px 0px var(--pure-black);
    transition: all 0.1s ease;
    cursor: none;
  }
  
  /* 移动端优化 */
  @media (max-width: 640px) {
    .neo-brutal-btn {
      box-shadow: 2px 2px 0px var(--pure-black);
    }
    
    .neo-brutal-btn:hover {
      transform: translate(-1px, -1px);
      box-shadow: 3px 3px 0px var(--pure-black);
    }
    
    .neo-brutal-btn:active {
      transform: translate(1px, 1px);
      box-shadow: 1px 1px 0px var(--pure-black);
    }
  }
  
  /* 桌面端交互 */
  @media (min-width: 641px) {
    .neo-brutal-btn {
      box-shadow: 4px 4px 0px var(--pure-black);
    }
    
    .neo-brutal-btn:hover {
      transform: translate(-2px, -2px);
      box-shadow: 6px 6px 0px var(--pure-black);
    }
    
    .neo-brutal-btn:active {
      transform: translate(2px, 2px);
      box-shadow: 2px 2px 0px var(--pure-black);
    }
  }
  
  .neo-brutal-btn.secondary {
    background: var(--pure-white);
    color: var(--pure-black);
    border: 2px solid var(--pure-black);
    box-shadow: 4px 4px 0px var(--neon-green);
  }
  
  /* 新粗野主义卡片样式 */
  .neo-brutal-card {
    border: 2px solid var(--pure-black);
    box-shadow: 4px 4px 0px var(--pure-black);
    background: var(--pure-white);
    transition: all 0.2s ease;
  }
  
  .dark .neo-brutal-card {
    border: 2px solid var(--pure-white);
    box-shadow: 4px 4px 0px var(--pure-white);
    background: var(--pure-black);
  }
  
  /* 移动端卡片优化 */
  @media (max-width: 640px) {
    .neo-brutal-card {
      box-shadow: 3px 3px 0px var(--pure-black);
    }
    
    .dark .neo-brutal-card {
      box-shadow: 3px 3px 0px var(--pure-white);
    }
    
    .neo-brutal-card:hover {
      transform: translate(-2px, -2px);
      box-shadow: 5px 5px 0px var(--tech-blue);
    }
  }
  
  /* 桌面端卡片交互 */
  @media (min-width: 641px) {
    .neo-brutal-card {
      box-shadow: 6px 6px 0px var(--pure-black);
    }
    
    .dark .neo-brutal-card {
      box-shadow: 6px 6px 0px var(--pure-white);
    }
    
    .neo-brutal-card:hover {
      transform: translate(-3px, -3px);
      box-shadow: 9px 9px 0px var(--tech-blue);
    }
  }

  .navlink {
    position: relative;
    cursor: none;
    text-decoration: none;
    font-weight: 500;
    color: var(--navbar-text-color);
    font-size: var(--navbar-text-size);
    letter-spacing: var(--navbar-text-letter-spacing);
    line-height: var(--navbar-text-line-height);
    transition: color 0.25s ease-out;
    padding: 0.5rem 0;
  }

  .navlink[data-active="true"]::after {
    transform: scaleX(1);
  }

  .navlink:hover {
    @apply dark:text-white;
  }

  .navlink:hover::after {
    transform: scaleX(1);
    transform-origin: bottom left;
  }

  .navlink::after {
    content: "";
    position: absolute;
    width: 100%;
    transform: scaleX(0);
    height: 2px;
    left: 0;
    bottom: 0;
    background-color: var(--tech-blue);
    transform-origin: bottom right;
    transition: transform 0.25s ease-out;
  }

  .webkit-reflect {
    -webkit-box-reflect: below 1px linear-gradient(transparent, #0005);
  }

  .contact_me_btn {
    background-image: radial-gradient(
        circle at 50% 85.69%,
        #8fe566,
        rgba(143, 229, 102, 0) 77.6%
      ),
      radial-gradient(
        circle at 50% 111.57%,
        #72e98a,
        rgba(114, 233, 138, 0) 56%
      ),
      radial-gradient(circle at 50% 132.04%, #0acf83, rgba(10, 207, 131, 0) 69%),
      linear-gradient(rgba(126, 249, 139, 0) 21%, #7ef98b 93.49%),
      linear-gradient(#0acf83, #0acf83);
    border-radius: 0.375rem;
    position: relative;
    overflow: hidden;
    box-shadow:
      inset 0 2px 2px rgba(221, 221, 221, 0.5),
      inset 0 -2px #13ae72,
      0 0 0 4px rgba(221, 221, 221, 0.05),
      0 20px 120px -10px rgba(10, 207, 131, 0.8);
  }

  .contact_me_btn_overlay {
    z-index: 1;
    opacity: 0;
    background-image: radial-gradient(
        circle at 176% 143%,
        #8fe566,
        rgba(143, 229, 102, 0) 77%
      ),
      radial-gradient(circle at 138% 79%, #fff, rgba(255, 255, 255, 0)),
      radial-gradient(circle at 50% 254.79%, #fff, rgba(255, 255, 255, 0)),
      linear-gradient(247deg, #7ef98b 48%, rgba(126, 249, 139, 0) 92%),
      linear-gradient(#0acf83, #0acf83);
    transition: opacity 0.2s;
    position: absolute;
    top: 0%;
    bottom: 0%;
    left: 0%;
    right: 0%;
  }

  .contact_me_btn:hover .contact_me_btn_overlay {
    opacity: 1;
  }

  .loading_dots span {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: #333;
    animation: loading_dots 1.4s infinite ease-in-out both;
  }

  .loading_dots span:nth-child(1) {
    animation-delay: -0.32s;
  }

  .loading_dots span:nth-child(2) {
    animation-delay: -0.16s;
  }

  @keyframes loading_dots {
    0%,
    80%,
    100% {
      transform: scale(0);
    }
    40% {
      transform: scale(1);
    }
  }

  /* Footer */
  .footer-bg {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  }

  /* Social Links */
  .social-link {
    transition: all 0.3s ease;
  }

  .social-link:hover {
    transform: translateY(-2px);
  }

  /* Custom utility classes */
  .text-gradient {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
  }

  .animate-float {
    animation: float 6s ease-in-out infinite;
  }

  @keyframes float {
    0%,
    100% {
      transform: translateY(0px);
    }
    50% {
      transform: translateY(-20px);
    }
  }

  .animate-pulse-slow {
    animation: pulse 4s cubic-bezier(0.4, 0, 0.6, 1) infinite;
  }

  .animate-spin-slow {
    animation: spin 3s linear infinite;
  }

  /* 滚动指示器样式 */
  .scroll-indicator {
    position: relative;
    cursor: pointer;
    padding: 8px;
    transition: all 0.3s ease;
  }
  
  .scroll-indicator:hover {
    transform: scale(1.1);
  }
  
  .scroll-indicator-line {
    width: 2px;
    height: 40px;
    background: linear-gradient(to bottom, 
      transparent 0%, 
      var(--tech-blue) 20%, 
      var(--tech-blue) 80%, 
      transparent 100%
    );
    margin: 0 auto;
    border-radius: 1px;
    position: relative;
    overflow: hidden;
  }
  
  .dark .scroll-indicator-line {
    background: linear-gradient(to bottom, 
      transparent 0%, 
      rgba(59, 130, 246, 0.8) 20%, 
      rgba(59, 130, 246, 0.8) 80%, 
      transparent 100%
    );
  }
  
  .scroll-indicator-line::after {
    content: '';
    position: absolute;
    top: -100%;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, 
      transparent 0%, 
      var(--neon-green) 50%, 
      transparent 100%
    );
    animation: scroll-flow 2s ease-in-out infinite;
  }
  
  .scroll-indicator-dot {
    width: 8px;
    height: 8px;
    background: var(--tech-blue);
    border-radius: 50%;
    margin: 8px auto 0;
    position: relative;
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.5);
    animation: scroll-pulse 2s ease-in-out infinite;
  }
  
  .dark .scroll-indicator-dot {
    background: rgba(59, 130, 246, 0.9);
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.7);
  }
  
  .scroll-indicator-dot::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    border: 2px solid var(--tech-blue);
    border-radius: 50%;
    opacity: 0;
    animation: scroll-ripple 2s ease-out infinite;
  }
  
  .dark .scroll-indicator-dot::before {
    border-color: rgba(59, 130, 246, 0.8);
  }
  
  @keyframes scroll-flow {
    0% {
      top: -100%;
      opacity: 0;
    }
    50% {
      opacity: 1;
    }
    100% {
      top: 100%;
      opacity: 0;
    }
  }
  
  @keyframes scroll-pulse {
    0%, 100% {
      transform: scale(1);
      box-shadow: 0 0 10px rgba(59, 130, 246, 0.5);
    }
    50% {
      transform: scale(1.2);
      box-shadow: 0 0 20px rgba(59, 130, 246, 0.8);
    }
  }
  
  @keyframes scroll-ripple {
    0% {
      transform: translate(-50%, -50%) scale(0);
      opacity: 1;
    }
    100% {
      transform: translate(-50%, -50%) scale(1);
      opacity: 0;
    }
  }

  .grid-pattern {
    background-image: radial-gradient(circle, #000 1px, transparent 1px);
    background-size: 20px 20px;
    opacity: 0.1;
  }

  .noise-pattern {
    position: relative;
  }

  .noise-pattern::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0.02;
    background: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='1' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
    pointer-events: none;
  }
}
